package cn.legend.travel.admin.content.pojo.entity;

import cn.legend.travel.admin.content.pojo.param.GuideIssueParam;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@TableName("content_guide_table")
public class Guide implements Serializable {
    @TableId(type = IdType.AUTO)
    Long id;
    String title;
    String coverUrl;
    String brief;
    Long authorId;
    String destinationName;
    Long viewCount;
    Long likeCount;
    Long commentCount;
    Integer state;
    Integer isDisplay;
    String keywords;
    Integer type;
    /**
     * 数据创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    LocalDateTime gmtCreate;

    /**
     * 数据最后修改时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    LocalDateTime gmtModified;

    public Guide() {
    }

    public Guide(GuideIssueParam param) {
        title = param.getTitle();
        coverUrl = param.getCoverUrl();
        brief = param.getBrief();
        keywords = param.getKeywords();
        type = param.getType();
        destinationName = param.getDestinationName();
        authorId = 1L;
        state = 1;
        isDisplay = 1;
    }
}
